/* 
 * File:   Button.h
 * Author: agu
 *
 * Created on 26 de mayo de 2014, 02:15
 */

#ifndef BUTTON_H
#define	BUTTON_H
#include <SDL2/SDL.h>
#include <string>
#include "Texture.h"
#include "Text.h"
#include "Sound.h"
#include "Runner.h"
using std::string;

class Button {
public:
    //Initializes internal variables
    Button(SDL_Renderer* renderer, const string path, const string effect,
            int x, int y);
    ~Button();

    //Handles mouse event
    void update(SDL_Event* e);
    void setPosition(int x,int y);
    void setRunner(Runner* runner);
    //Shows button sprite
    void render();
    string getKeyName();

private:
    string keyName;
    //Button constants
    static const int BUTTON_WIDTH = 164;
    static const int BUTTON_HEIGHT = 39;
    static const int TOTAL_BUTTONS = 4;

    enum ButtonSprite {
        BUTTON_SPRITE_MOUSE_DOWN = 0,
        BUTTON_SPRITE_MOUSE_UP = 1,
        BUTTON_SPRITE_TOTAL = 2
    };
    //Currently used global sprite
    ButtonSprite currentSprite;
    //Mouse button sprites
    SDL_Rect spriteClips[ BUTTON_SPRITE_TOTAL ];
    Texture texture;
    Sound effect;
    Runner* runner;
};
#endif	/* BUTTON_H */

